﻿<Page
    x:Name="pageRoot"
    x:Class="SmartPatientCentre.Pages.ResultDetails"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:SmartPatientCentre.Pages"
    xmlns:repo="using:SmartPatientCentre.Repositories"
    xmlns:common="using:SmartPatientCentre.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:oxy="using:OxyPlot.Metro"
    d:DataContext="{Binding Source={d:DesignInstance Type=repo:PatientRepository, IsDesignTimeCreatable=True}}"
    mc:Ignorable="d">

    <Page.Resources>
        
        <x:String x:Key="ChevronGlyph">&#xE26B;</x:String>

        <CollectionViewSource
        x:Name="ResultList"
        Source="{Binding ResultList}"/>

    </Page.Resources>

    <!-- Top AppBar -->
    <Page.TopAppBar>
        <CommandBar>
            <AppBarButton Label="Logout" Icon="Clear" Click="LogoutButtonClick" />
            <CommandBar.SecondaryCommands>
                <AppBarButton Label="Dashboard" Icon="Home" Click="DashboardButtonClick" />
                <AppBarButton Label="My Patients" Icon="ContactInfo" Click="MyPatientsButtonClick" />
                <AppBarButton Label="All Patients" Icon="ViewAll" Click="AllPatientsButtonClick" />
            </CommandBar.SecondaryCommands>
        </CommandBar>
    </Page.TopAppBar>

    <!--
        This grid acts as a root panel for the page.
    -->
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.ChildrenTransitions>
            <TransitionCollection>
                <EntranceThemeTransition/>
            </TransitionCollection>
        </Grid.ChildrenTransitions>

        <Hub>
            <!-- Result Header -->
            <Hub.Header>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="80"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    
                    <!-- Back Button -->
                    <Button  x:Name="backButton" Margin="-1,-1,39,0" Command="{Binding NavigationHelper.GoBackCommand, ElementName=pageRoot}"
                        Style="{StaticResource NavigationBackButtonNormalStyle}"
                        VerticalAlignment="Top"
                        AutomationProperties.Name="Back"
                        AutomationProperties.AutomationId="BackButton"
                        AutomationProperties.ItemType="Navigation Button"/>
                    
                    <!-- Patient Tile -->
                    <Grid DataContext="{Binding Patient}" Grid.Column="1" HorizontalAlignment="Left" Width="300">
                        <StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Background="#FFEEEEEE" Margin="0,-30,0,0">
                            <Border Background="{Binding GenderColor}" Height="100" Width="100">
                                <TextBlock Text="{Binding Initials}" Style="{StaticResource HeaderTextBlockStyle}" TextAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center" />
                            </Border>
                            <StackPanel Width="200" VerticalAlignment="Center">
                                <TextBlock Text="{Binding FullName}" Style="{StaticResource TitleTextBlockStyle}" HorizontalAlignment="Center" FontWeight="Bold"/>
                                <TextBlock Text="{Binding Ward}" Style="{StaticResource SubtitleTextBlockStyle}" HorizontalAlignment="Center"/>
                                <TextBlock Text="{Binding RoomBed}" Style="{StaticResource SubtitleTextBlockStyle}" HorizontalAlignment="Center"/>
                            </StackPanel>
                        </StackPanel>
                    </Grid>

                </Grid>
            </Hub.Header>

            <!-- Chart HubSection -->
            <HubSection x:Name="ChartHub" Margin="70,0,0,0">
                <DataTemplate>
                    
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>

                        <Grid Grid.Row="0" DataContext="{Binding Chart}">
                            <oxy:Plot Model="{Binding Model}" Height="500" Width="500" />
                        </Grid>
                        
                        <!--<Grid Grid.Row="1">
                            <StackPanel Orientation="Horizontal" >
                                <ToggleButton Content="Days" />
                                <ToggleButton Content="Weeks" />
                                <ToggleButton Content="Months" />
                            </StackPanel>
                        </Grid>-->

                    </Grid>
                    
                </DataTemplate>
            </HubSection>
            
            <!-- Result List -->
            <HubSection Header="All Results" IsHeaderInteractive="True">
                <DataTemplate>
                    <GridView
                        AutomationProperties.AutomationId="ItemsGridView"
                        AutomationProperties.Name="Items"
                        ItemsSource="{Binding Source={StaticResource ResultList}}"
                        ItemTemplate="{StaticResource ResultTile}"
                        SelectionMode="None"
                        IsSwipeEnabled="false" >
                    </GridView>
                </DataTemplate>
            </HubSection>

            <!-- Example Lorum Ipsum -->
            <!--<HubSection Width="500" Header="Section 1">
                <DataTemplate>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <Image Stretch="Fill" Width="420" Height="280"/>
                        <TextBlock Style="{StaticResource SubheaderTextBlockStyle}" Grid.Row="1" Margin="0,10,0,0" TextWrapping="Wrap" 
                                   Text="Lorem ipsum dolor sit nonumy sed consectetuer ising elit, sed diam"/>
                        <TextBlock Style="{StaticResource TitleTextBlockStyle}" Grid.Row="2" Margin="0,10,0,0"
                                   Text="Description text:"/>
                        <TextBlock Style="{StaticResource BodyTextBlockStyle}" Grid.Row="3" 
                                   Text="Lorem ipsum dolor sit amet, consectetuer ising elit, sed diam nonummy nibh uismod tincidunt ut laoreet suscipit lobortis ni ut wisi quipexerci quis consequat minim veniam, quis nostrud exerci tation ullam corper. Lorem ipsum dolor sit amet, consectetuer ising elit, sed diam nonummy nibh uismod tincidunt ut laoreet suscipit lobortis ni ut wisi quipexerci quis consequat minim veniam, quis nostrud exerci tation ullam corper. "/>
                    </Grid>
                </DataTemplate>
            </HubSection>-->

            <!--<HubSection Header="Section 3">
                <DataTemplate>
                    --><!-- width of 400 --><!--
                    <StackPanel Orientation="Vertical">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="130"/>
                                <ColumnDefinition Width="5"/>
                                <ColumnDefinition Width="130"/>
                                <ColumnDefinition Width="5"/>
                                <ColumnDefinition Width="130"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="270"/>
                                <RowDefinition Height="95"/>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <Image Grid.ColumnSpan="5" Stretch="Fill" Margin="0,0,0,10"/>
                            <Image Grid.Row="1" Stretch="Fill"/>
                            <Image Grid.Row="1" Grid.Column="2" Stretch="Fill"/>
                            <Image Grid.Row="1" Grid.Column="4" Stretch="Fill"/>
                            <TextBlock Style="{StaticResource TitleTextBlockStyle}" Grid.Row="2" Grid.ColumnSpan="5" Margin="0,15,0,0"
                                       Text="Description Text:"/>
                            <TextBlock Style="{StaticResource BodyTextBlockStyle}" Grid.Row="3" Grid.ColumnSpan="5" 
                                       Text="Lorem ipsum dolor sit amet, consectetuer ising elit, sed diam nonummy nibh uismod tincidunt ut laoreet suscipit lobortis ni ut wisi quipexerci quis consequat minim veniam, quis nostrud exerci tation ullam corper. Lorem ipsum dolor sit amet, consectetuer ising elit, sed diam nonummy nibh uismod tincidunt ut laoreet suscipit lobortis ni ut wisi quipexerci quis consequat minim veniam, quis nostrud exerci tation ullam corper."/>
                        </Grid>
                    </StackPanel>
                </DataTemplate>
            </HubSection>-->
            
        </Hub>
    </Grid>
</Page>
